<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link th:href="@{/css/shop.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/css/pagina.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/css/Sellerber.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/css/bkg_ui.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/font/css/font-awesome.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/js/laydate/laydate.js}" type="text/javascript"></script>
    <script th:src="@{/js/jquery-1.9.1.min.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/js/jquery.cookie.js}"></script>
    <script th:src="@{/js/shopFrame.js}" type="text/javascript"></script>
    <script th:src="@{/js/Sellerber.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/js/proTree.js}"></script>
    <script th:src="@{/js/jquery.easy-pie-chart.min.js}"></script>
    <script th:src="@{/js/html5shiv.js}" type="text/javascript"></script>
    <script th:src="@{/js/respond.min.js}"></script>
    <script th:src="@{/js/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/js/css3-mediaqueries.js}" type="text/javascript"></script>
    <script th:src="@{/js/Order_form.js}" type="text/javascript"></script>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>

    <title>订单列表</title>
</head>
<body>
<div class="beijing"></div>
<div class="bianse"></div>
<div class="list_Exhibition list_show padding15">
    <div class="operation clearfix mb15 searchs_style">
        <div class="search  clearfix" style="width: 1300px">
            <form id="pageFrm" th:action="@{/mainOrder/selectMainOrderInfo}" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <label class="label_name">开始时间：</label>
                <input class="laydate-icon col-xs-2 col-lg-2 form-control Select_Date" name="orderTime" id="start"
                       type="text" th:value="${orderTime==''?'':orderTime}">
                <span style=" float:left; padding:0px 10px; line-height:32px;">结束时间</span>
                <input class="laydate-icon col-xs-2 col-lg-2 form-control Select_Date" name="payTime" id="end"
                       type="text" th:value="${payTime==''?'':payTime}">
                <span style=" float:left; padding:0px 10px; line-height:32px;">订单状态</span>
                <select id="sel" name="status"
                        class="col-xs-2 col-lg-2 form-control Select_Date">
                    <option value="-1">请选择</option>
                    <option value="0">待支付</option>
                    <option value="1">待出票</option>
                    <option value="2">待收货</option>
                    <option value="3">已完成</option>
                    <option value="4">已取消</option>
                    <option value="5">已退款</option>
                </select>
                <span style=" float:left; padding:0px 10px; line-height:32px;">订单号</span>
                <input class="col-xs-2 col-lg-2 form-control Select_Date" id="mainOrderNum" type="text" name="orderNum"
                       th:value="${orderNum==''?'':orderNum}" style="width: 200px;">
                <!--<a class=" btn button_btn bg-deep-blue"  type="submit"><i
                        class="fa  fa-search"></i>&nbsp;搜索</a>-->
                <button type="submit" id="sousuo" class="btn button_btn bg-deep-blue"><i class="fa  fa-search"></i>&nbsp;搜索
                </button>
            </form>
            <input type="hidden" id="status" th:value="${status==''?'':status}"/>
        </div>
    </div>
</div>
<div class="datalist_show">
    <div class="datatable_height confirm">
        <table class="table table_list table_striped table-bordered">
            <thead>
            <tr>
                <th width="25px"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
                <th width="80px">主键id</th>
                <th width="150px">收件人姓名</th>
                <th width="80px">
                    图片
                </th>
                <th width="260px">地址</th>
                <th width="110px">订单编号</th>
                <th width="180px">下单时间</th>
                <th width="180px">支付时间</th>
                <th width="100px">订单状态</th>
                <th width="100px">配送方式</th>
                <th width="100px">商品数量</th>
                <th width="80px">总价格</th>
                <th width="80px">邮费</th>
                <th width="150px">物流号</th>
                <th width="200px">操作</th>
            </tr>
            </thead>
            <tbody id="tbody">
            <tr th:each="mainOrder : ${map.p}">
                <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
                <td th:text="${mainOrder.mainOrderId}"></td>
                <td class="order_product_name" th:text="${mainOrder.receiveName}"></td>
                <!--<td th:text="${mainOrder.skuId}"></td>-->
                <td>
                    <img th:src="${mainOrder.imgUrl}" alt=""/>
                </td>
                <td th:text="${mainOrder.receiveAddress}"></td>
                <td th:text="${mainOrder.orderNum} "></td>
                <td th:text="${mainOrder.orderTime}"></td>
                <td th:text="${mainOrder.payTime}"></td>
                <td class="td-status">
                    <label th:if="${mainOrder.status==0}"><span class="label label-success radius">待支付</span></label>
                    <label th:if="${mainOrder.status==1}"><span class="label label-success radius">待出票</span></label>
                    <label th:if="${mainOrder.status==2}"> <span class="label label-defaunt radius">待收货</span></label>
                    <label th:if="${mainOrder.status==3}"><span class="label label-success radius">已完成</span></label>
                    <label th:if="${mainOrder.status==4}"><span class="label label-success radius">已取消</span></label>
                    <label th:if="${mainOrder.status==5}"><span class="label label-success radius">已退款</span></label>
                </td>
                <td th:text="${mainOrder.deliverType}"></td>
                <td th:text="${mainOrder.count}"></td>
                <td th:text="${mainOrder.totalPrice}"></td>
                <td th:text="${mainOrder.postage}"></td>
                <td th:text="${mainOrder.logisticsNum}"></td>
                <td>
                    <label th:if="${mainOrder.status==1}">
                        <a href="javascript:void (0)" title="发货"
                           th:onclick="'javascript:Delivery_stop('+this+','+${mainOrder.mainOrderId}+');'"
                           shiro:hasPermission="user:updateOrders" class="btn btn-xs btn-status">发货</a>
                    </label>

                    <a title="订单详细" href="javascript:void(0)" class="btn btn-xs btn-info"
                       th:onclick="'javascript:goOrderDetaileds('+${mainOrder.mainOrderId}+')'">详细</a>
                </td>
            </tr>
            </tbody>
        </table>
        <!--<div id="paging">
            <div class="pagination">
                <lable th:if="${page.number+1}>1">
                    <a class='' title='首页' th:id="0" onclick="page_nav(document.forms[0],this);">首页</a>
                    <a class='' title='上一页' th:id="${page.number}-1" onclick="page_nav(document.forms[0],this)">上一页</a>
                </lable>
                <lable th:if="${page.number+1}<=1">
                    <button class='disabled' disabled="disabled" title='首页' th:id="0"
                            onclick="page_nav(document.forms[0],this);">首页
                    </button>
                    <button class='disabled' disabled="disabled" title='上一页' th:id="${page.number}-1"
                            onclick="page_nav(document.forms[0],this)">上一页
                    </button>
                </lable>
                <lable th:each=" i:${#numbers.sequence((page.number)-1,(page.number)+2)}">
                    <lable th:if="${i>=1&&i<=page.totalPages}">
                        <lable th:if="${i==page.number+1}">
                            <span class='current' th:text="${i}" th:id="${i}"
                                  onclick="page_nav(document.forms[0],this)"></span>
                        </lable>
                        <lable th:if="${i != page.number+1}">
                            <span th:text="${i}" th:id="${i}" onclick="page_nav(document.forms[0],this)"></span>
                        </lable>
                    </lable>
                </lable>
                <lable th:if="${page.number+1<page.totalPages}">
                    <a th:id="${page.number}+1" onclick="page_nav(document.forms[0],this);">下一页</a>
                    <a th:id="${page.totalPages}" onclick="page_nav(document.forms[0],this);">尾页</a>
                </lable>
                <lable th:unless="${page.number+1 != page.totalPages}">
                    <button class='disabled' disabled="disabled" th:id="${page.number}+1"
                            onclick="page_nav(document.forms[0],this);" aria-controls="datatable-responsive"
                            data-dt-idx="1" tabindex="0">下一页
                    </button>
                    <button class='disabled' disabled="disabled" th:id="${page.totalPages}"
                            onclick="page_nav(document.forms[0],this);">尾页
                    </button>
                </lable>
            </div>
        </div>-->
    </div>
</div>


<!--发货-->
<div id="Delivery_stop" style=" display:none;">
    <div class="padding15">
        <div class="content_style">
            <div class="form-group"><label class="col-sm-2 control-label no-padding-right" for="form-field-1">
                快递号 </label>
                <div class="col-xs-8 col-sm-8 col-md-8 col-lg-9">
                    <input type="text" id="orderNum" placeholder="快递号" class="col-xs-10 col-sm-8 col-xs-8"
                           style="margin-left:0px;width: 100%;"></div>
            </div>
        </div>
    </div>
</div>
<div id="text1"></div>
<input type="hidden" id="totalElements" th:value="${map.orderInfo.totalElements}"/>
<input type="hidden" id="number" th:value="${map.orderInfo.number}"/>
</body>
</html>
<script type="text/javascript">


    var resultData = {result: null}


    function goOrderDetaileds(mainOrderId) {
        location.href = "/mainOrder/getOrder_detaileds?mainOrderId=" + mainOrderId + "";
    }

    //设置内页框架布局
    $(function () {
        $("#Sellerber").frame({
            float: 'left',
            color_btn: '.skin_select',
            Sellerber_menu: '.list_content',
            page_content: '.list_show',//内容
            datalist: ".datatable_height",//数据列表高度取值
            header: 65,//顶部高度
            mwidth: 200,//菜单栏宽度
            minStatue: true,
        });


    })
    /**
     * 时间设置
     */
    var start = {
        elem: '#start',
        format: 'YYYY-MM-DD',
        // min: laydate.now(), //设定最小日期为当前日期
        max: '2099-06-16', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY-MM-DD',
        //min: laydate.now(),
        max: '2099-06-16',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);


    /**发货**/
    function Delivery_stop(obj, id) {
        layer.open({
            type: 1,
            title: '发货',
            maxmin: true,
            shadeClose: false,
            area: ['400px', ''],
            content: $('#Delivery_stop'),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                if ($('#orderNum').val() == "") {
                    layer.alert('快递号不能为空！', {
                        title: '提示框',
                        icon: 0,
                    })
                } else {
                    layer.confirm('提交成功！', function (index) {
                        var logisticsNum = $("#orderNum").val();
                        var aa = null;
                        $.ajax({
                            url: "/mainOrder/updMainOrderStatusByMainOrderId",
                            method: "POST",
                            data: {
                                mainOrderId: id,
                                logisticsNum: logisticsNum,
                            },
                            async: false,
                            success: function (data) {
                                if (data > 0) {
                                    resultData.result = true;
                                } else {
                                    alert("修改失败");
                                    resultData.result = false;
                                }
                            }
                        });
                        if (resultData.result == true) {
                            $(obj).parents("tr").find(".td-manage").prepend('<a style=" display:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="已发货"><i class="fa fa-cubes bigger-120"></i></a>');
                            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已发货</span>');
                            $(obj).remove();
                            layer.msg('已发货!', {icon: 6, time: 1000});
                            layer.close(index);
                            $("#Delivery_stop").hide();
                            $("#orderNum").val("");
                            location.href = "/mainOrder/selectMainOrderInfo";
                            resultData.result = null;
                        }
                    })

                }
            }
        })
    };
    var oldie = /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase());
    $('.easy-pie-chart.percentage').each(function () {
        $(this).easyPieChart({
            barColor: $(this).data('color'),
            trackColor: '#EEEEEE',
            scaleColor: false,
            lineCap: 'butt',
            lineWidth: 10,
            animate: oldie ? false : 1000,
            size: 103
        }).css('color', $(this).data('color'));
    });
</script>
